// 对应的6版本路由的组件就建议都用函数组件了

import React from "react";
import { Link, Routes, Route } from "react-router-dom";

const Home = () => <div>这是首页</div>;
const About = () => <div>这是关于页</div>;

const App = () => {
  return (
    <div>
      <h2>router-v6-basic</h2>
      <ul>
        <li>
          <Link to="/">首页</Link>
        </li>
        <li>
          <Link to="/about">关于页</Link>
        </li>
      </ul>

      <hr />

      <Routes>
        {/* 渲染组件的方式，现在只能使用element属性了, element要写成标签 */}
        {/* 6版本的路由默认是精准匹配了 */}
        {/* 6版本的路由默认是排他性路由了 */}
        <Route path="/" element={<Home></Home>}></Route>
        <Route path="/about" element={<About />}></Route>
      </Routes>
    </div>
  );
};

export default App;
